/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: DcmDslCfg.h
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: DCMDSL
*
* Revision:
* --------------------------------------------------------------------------------
* v0.1: 
* --Yueting.Ben, 2024-03-11 
* --Initial release

**********************************************************************************/
#ifndef DCMDSLCFG_H
#define DCMDSLCFG_H

/** HEADER FILES **/
#include "DcmType.h"
#include "DcmCfg.h"
#include "DcmRte.h"
#include "DcmDslType.h"
#include "DcmDsdCfg.h"


/** MACRO DEFINITION **/
#define DCM_DSL_PROTOCAL_MAX_RES_SIZE     100
#define DCM_DSL_RES_PEND_MAX_RES_SIZE     3


/** TYPEDEF DEFINITION **/
typedef struct
{
    void* txPduPtr; /* DcmDslProtocolTxPduRef */
    uint16 txConfirmationPduId; /* DcmDslTxConfirmationPduId */
}DcmDslProtocolTxType;


typedef struct
{
    void* rxPduPtr; /* DcmDslProtocolRxPduRef */
    PduIdType rxPduId; /* DcmDslProtocolRxPduId */
    DcmDsl_ProtocolRxAddrType rxAddrType; /* DcmDslProtocolRxAddrType */
}DcmDslProtocolRxType;


typedef struct
{
    uint16 rxConnectionId; /* DcmDslProtocolRxConnectionId */
    void* comMChannelPtr; /* DcmDslProtocolComMChannelRef */
    DcmDslProtocolTxType protocolTx; /* DcmDslProtocolTx */
    DcmDslProtocolRxType protocolRx; /* DcmDslProtocolRx */
}DcmDslMainConnectionType;


typedef struct
{
    uint16 periodicTxConfirmationPduId; /*  DcmDslPeriodicTxConfirmationPduId */
}DcmDslPeriodicTransmissionType;


typedef struct
{
    DcmDslMainConnectionType mainConnection; /* DcmDslMainConnection  */
    DcmDslPeriodicTransmissionType periodicConnection; /* DcmDslPeriodicTransmission   */
}DcmDslConnectionType;


typedef uint8 DcmDslProtocolTypeType; /* DcmDslProtocolType */


typedef struct
{
    uint16 ecuAddr; /* DcmDspProtocolEcuAddr */
    uint16 maximumResponseSize; /* DcmDslProtocolMaximumResponseSize     */
    /* If set to TRUE, the Dcm will send a NRC 0x78 before a transition to bootloader or performing an ECU reset. 
    If set to False, no 0x78 is send in this case. */
    uint8 sendRespPendOnRestart; /*   DcmSendRespPendOnRestart */
    Dcm_MsgType rxBufferPtr; /* DcmDslProtocolRxBufferRef */
    Dcm_MsgType txBufferPtr; /* DcmDslProtocolTxBufferRef */
    DcmDslConnectionType connection; /* DcmDslConnection */
    Dcm_SvcCfgType*  serviceTable; /* DcmDsdServiceTable */
}DcmDslProtocolRowType;


typedef struct
{
    DcmDslProtocolRowType protocolRow[DcmConf_DcmRxPduCfg_Pdu_Max]; /* DcmDslProtocolRow   */
}DcmDslProtocolType;


/** LOCAL DATA DEFINITION **/
extern Dcm_MsgItemType Dcm_DslBuffer[DCM_DSL_PROTOCAL_MAX_RES_SIZE];
extern Dcm_MsgItemType Dcm_DslDiagResp[DCM_DSL_RES_PEND_MAX_RES_SIZE];
extern DcmDslProtocolType DcmDslProtocolCfg;


#endif
